﻿<controlli:BaseCusControl x:Class="DocManagerControls.Controls.CodificheControl"
             xmlns:controlli="clr-namespace:DocManagerControls.Controls"
             xmlns:convSel="clr-namespace:DocManagerControls.Converters"
             xmlns:classi="clr-namespace:DocManagerControls.CLASSI"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" MinHeight="300" MinWidth="300" Width="Auto">
    <controlli:BaseCusControl.Resources>

        <convSel:CodificheDataTemplateSelector x:Key="codificheDataTemplateSelector"/>
        <convSel:ColumnsTemplateSelector x:Key="ColumnsTemplateSelector"/>
        <!--<classi:CategorieList x:Key="getDatiCodifiche" />-->
         
    </controlli:BaseCusControl.Resources>
        <Grid Width="Auto">
        <StackPanel Width="Auto">

            <StackPanel Orientation="Horizontal" Width="Auto">
                <StackPanel Orientation="Horizontal" Width="Auto">

                    <ListView MinHeight="100" MinWidth="100" Name="listViewTabelle"  Margin="2" MouseDoubleClick="listViewTabelle_MouseDoubleClick" SelectionChanged="listViewTabelle_SelectionChanged" />

                    <StackPanel>
                        <controlli:FilterDataControl x:Name="myDataFilter"></controlli:FilterDataControl>
                            <DataGrid x:Name="myGrid"  Margin="2" Validation.Error="myGrid_Error"  EnableRowVirtualization="True" IsSynchronizedWithCurrentItem="True"
                              AlternatingRowBackground="#CD50B2C4" AllowDrop="True" CanUserAddRows="True"
                  CanUserDeleteRows="True" CanUserReorderColumns="True" CanUserResizeColumns="True" 
                   Width="600" MinWidth="300"  Height="400"  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
                 RowHeight="23" 
                  BeginningEdit="myGrid_BeginningEdit" InitializingNewItem="myGrid_InitializingNewItem" ManipulationStarted="myGrid_ManipulationStarted" 
                  RowEditEnding="myGrid_RowEditEnding" SourceUpdated="myGrid_SourceUpdated" SelectionChanged="myGrid_SelectionChanged">
                        <DataGrid.Columns></DataGrid.Columns>
                        <DataGrid.Resources>
                            <Style TargetType="{x:Type DataGridCell}">
                                <Setter Property="VerticalContentAlignment" Value="Center" />
                            </Style>

                            <Style TargetType="{x:Type DataGridColumnHeader}">
                                <Setter Property="Height" Value="20" />
                                <Setter Property="Background" Value="Yellow" />
                                <Setter Property="Foreground" Value="Blue" />
                                <Setter Property="VerticalContentAlignment" Value="Center" />
                                <Setter Property="BorderThickness" Value="3,1,1,1" />
                                    <Setter Property="BorderBrush" Value="Gray" />
                                </Style>

                            <Style TargetType="{x:Type DataGridRow}">
                                <Setter Property="BorderThickness" Value="1"/>
                                <Setter Property="BorderBrush" Value="Blue"/>
                                <Setter Property="ValidationErrorTemplate">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Ellipse Width="12" Height="12"
                        Fill="OrangeRed" Stroke="Black"  StrokeThickness="0.5"/>
                        
                                                <TextBlock FontWeight="Bold" Padding="4,0,0,0"
                        Margin="0" VerticalAlignment="Top" Foreground="White" Text="!"
                        ToolTip="{Binding RelativeSource={RelativeSource
                                 FindAncestor, AncestorType={x:Type DataGridRow}},
                                 Path=(Validation.Errors)[0].ErrorContent}"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                    </DataGrid.Resources>

                    </DataGrid>

                    </StackPanel>

                </StackPanel>
                <!--<controlli:DynamicControl x:Name="myDetails" ContentTemplateSelector="{StaticResource codificheDataTemplateSelector}" />-->
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <controlli:PaginatorControl x:Name="myPaginator" QuantielementiPerpagina="14" />

            <Button Content="Salva" Height="23" VerticalAlignment="Center" Name="btnSalva"  
                 Width="75" Click="btnSalva_Click" Style="{StaticResource OrangeButton}" />

            </StackPanel>

        </StackPanel>
    </Grid>
</controlli:BaseCusControl>
